package com.ayic.garbagerecycle.mapper;

import com.ayic.garbagerecycle.pojo.User;
import org.apache.ibatis.annotations.Insert;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;

@Mapper
public interface RegisterMapper {
    @Select("SELECT COUNT(*) FROM users WHERE username = #{username}")
    int checkUsername(String username);

    @Insert("INSERT INTO users(username, password, email, created_at,role) VALUES(#{username}, #{password}, #{email}, #{createdAt},#{role})")
    int insertUser(User user);
}
